﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ctr='clr-namespace:NczControlLibrary.Controls'>
    <Style TargetType='ctr:AntiColorButton'>
        <Setter Property='Template'>
            <Setter.Value>
                <ControlTemplate TargetType='ctr:AntiColorButton'>
                    <Border x:Name='fBorderRoot' BorderBrush='{TemplateBinding BorderBrush}' BorderThickness='{TemplateBinding BorderThickness}' Background='{TemplateBinding Background}' Width='{TemplateBinding Width}' Height='{TemplateBinding Height}'>
                        <Border.RenderTransform>
                            <TranslateTransform/>
                        </Border.RenderTransform>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name='vsg1'>
                                <VisualState x:Name='nomal'/>
                                <VisualState x:Name='mouseover'>
                                    <Storyboard>
                                        <!--#488ac4-->
                                        <ColorAnimation Duration='0' To='{Binding Path=(Rectangle.Fill).(SolidColorBrush.Color),ElementName=fRectangle}' Storyboard.TargetName='fBorderRoot' Storyboard.TargetProperty='(Border.Background).(SolidColorBrush.Color)'/>
                                        <ColorAnimation Duration='0' To='White' Storyboard.TargetName='fTextBlock' Storyboard.TargetProperty='(TextBlock.Foreground).(SolidColorBrush.Color)'/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='mouseleave'>
                                    <Storyboard>
                                        <ColorAnimation Duration='0' To='{Binding ElementName=fRectangle, Path=(Rectangle.Background).(SolidColorBrush.Color)}' Storyboard.TargetName='fBorderRoot' Storyboard.TargetProperty='(Border.Background).(SolidColorBrush.Color)'/>
                                        <ColorAnimation Duration='0' To='{Binding ElementName=fRectangle, Path=(Rectangle.Stroke).(SolidColorBrush.Color)}' Storyboard.TargetName='fTextBlock' Storyboard.TargetProperty='(TextBlock.Foreground).(SolidColorBrush.Color)'/>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name='vsg2'>
                                <VisualState x:Name='mouseleftbuttondown'>
                                    <Storyboard>
                                        <DoubleAnimation Duration='0:0:.05' To='.5d' Storyboard.TargetName='fBorderRoot' Storyboard.TargetProperty='(Border.RenderTransform).(TranslateTransform.X)'/>
                                        <DoubleAnimation Duration='0:0:.05' To='.8d' Storyboard.TargetName='fBorderRoot' Storyboard.TargetProperty='(Border.RenderTransform).(TranslateTransform.Y)'/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name='mouseleftbuttonup'>
                                    <!--<Storyboard>
                                        <DoubleAnimation Duration='0:0:.05' To='.5d' Storyboard.TargetName='fBorderRoot' Storyboard.TargetProperty='(Border.RenderTransform).(TranslateTransform.X)'/>
                                        <DoubleAnimation Duration='0:0:.05' To='.8d' Storyboard.TargetName='fBorderRoot' Storyboard.TargetProperty='(Border.RenderTransform).(TranslateTransform.Y)'/>
                                    </Storyboard>-->
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid Name='fGrid' HorizontalAlignment='Stretch' VerticalAlignment='Stretch'>
                            <Rectangle Width='0' x:Name='fRectangle' Fill='{TemplateBinding Enterground}' Stroke='{TemplateBinding Foreground}'/>
                            <TextBlock x:Name='fTextBlock' VerticalAlignment='Center' HorizontalAlignment='Center' TextAlignment='Center' Foreground='{TemplateBinding Foreground}' FontSize='{Binding FontSize,FallbackValue=14}' Text='{TemplateBinding Text}'/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
